package com.zrrd.yunchmall.product.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zrrd.yunchmall.product.service.ISkuStockService;
import com.zrrd.yunchmall.util.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * sku的库存 前端控制器
 * </p>
 *
 * @author LYY
 * @since 2024-01-15
 */
@RestController
@RequestMapping("/sku")
public class SkuStockController {

    @Autowired
    private ISkuStockService service;

    @ApiOperation("查询库存")
    @GetMapping("/{id}")
    public ResponseResult selectSku(@PathVariable("id") int id){
        QueryWrapper queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("id",id);
        return new ResponseResult<>(200,"查询成功!",service.getOne(queryWrapper));
    }
}
